﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _1st_Project
	{
	class Program
		{
		static void Main(string[] args)
			{
			/* Project 1, design a program where the user can enter several numbers,
			 * one after the other, but when the user enters the number -99 the program should display the highest and lowest number
			 */
			Int64 i = 0, smallest = 0, biggest = 0, number = 0;
			print("This program will allow you to enter 1 number at a time unlimitedly untill you type the number -99\nand it will give you the higest and lowest number of all the numbers you have typed\nNOT INCLUDING the number -99");
			while (number != -99)
				{
				getNumber(ref number, ref i);
				if (number != -99)
					{
					replaceAnswer(ref smallest, ref biggest, number);
					}
				}
			print("SMALLEST: " + smallest + " BIGGEST: " + biggest);
			}// end Main
		static void replaceAnswer(ref Int64 smallest, ref Int64 biggest, Int64 number)
			{
			if (smallest == 0 && biggest == 0)
			{
				smallest = number;
				biggest = number;
			}
			if (number < smallest)
				{
				smallest = number;
				}
			if (number > biggest)
				{
				biggest = number;
				}
			}// end repleaceAnswer
		static void getNumber(ref Int64 number, ref Int64 i)
			{
			print("Type a number to be added to the database:");
			while (!Int64.TryParse(Console.ReadLine(), out number))
				print("Invalid Number, please provide a whole number.");
			i++;
			}// end getNumber
		static void print(string p)
			{
			Console.WriteLine("{0}", p);
			}// end print
		}
	}
